import axios from '@/components/util/AxiosPlugin';
import GlobalUtil from '@/components/util/GlobalUtil';
const SERVICE_NAME = "/publish-gateway"

/** 查询用户 */
export function userSearch(params, callback) {
    return axios.post(SERVICE_NAME + "/user/search", params)
    .then(data => callback(data))
    .catch(e => {GlobalUtil.catchError(e)});
}

/** 删除用户 **/
export function deleteUser(userId, callback) {
    return axios.get(SERVICE_NAME + '/user/delete?userId=' + userId)
    .then(data => callback(data))
    .catch(e => {GlobalUtil.catchError(e)});
}

/** 用户新增 **/
export function addUser(params, callback){
    return axios.post(SERVICE_NAME + '/user/register', params)
    .then(data => callback(data))
    .catch(e => {GlobalUtil.catchError(e)});
}

/** 用户更新 **/
export function updateUser(params, callback){
    return axios.post(SERVICE_NAME + '/user/update', params)
    .then(data => callback(data))
    .catch(e => {GlobalUtil.catchError(e)});
}